
#include <QQmlApplicationEngine>
#include <QApplication>

#include "dpm_service.h"

#include "trayicon.h"
#include <QQmlContext>


int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QApplication app(argc, argv);
    app.setQuitOnLastWindowClosed(false);



    //处理程序

    DPM_Service servic;

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);

    engine.rootContext()->setContextProperty("servic",&servic);

    engine.load(url);

    //托盘图标
   // TrayIcon trayIcon;
    //  trayIcon.engine=&engine;

    return app.exec();
}
